package com.liam.robot;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class Test {

    public static void main(String[] args) throws AWTException, InterruptedException {
        // 创建机器人对象
        Robot robot = new Robot();

        //------------------键盘---------------

        // 安下k建
        robot.keyPress(KeyEvent.VK_K);
        robot.delay(300);
//        // 弹起k建
        robot.keyRelease(KeyEvent.VK_K);


        //---------------鼠标------------------
//        robot.mouseMove(1150, 850);
//
//        // 按下鼠标 左建
//        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
//        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

        //---------------- 获取屏幕颜色 -----------------

//        robot.mouseMove(920, 850);

        Color color = robot.getPixelColor(920, 850);
        System.out.println(color.getRed()+","+color.getBlue()+","+color.getGreen());

    }
}
